package leetcode.code1744;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution implements IDebug {

	public boolean[] canEat(int[] candiesCount, int[][] queries) {
		int len = candiesCount.length;
		long[] sums = new long[len + 1];
		for (int i = 1; i <= len; i++) {
			sums[i] = sums[i - 1] + candiesCount[i - 1];
		}
		boolean[] ans = new boolean[queries.length];
		for (int i = 0; i < queries.length; i++) {
			int[] query = queries[i];
			int type = query[0], day = query[1], cap = query[2];
			ans[i] = type < len && sums[type + 1] >= day + 1 && sums[type] < 1l * (day + 1) * cap;
		}
		return ans;
	}

	@Override
	public void debug4() {
		// [true,false,true]
		this.canEat(H.str2array3("[7,4,5,3,8]"), H.str2array1("[[0,2,2],[4,2,4],[2,13,1000000000]]"));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
